package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	FeeHouseEventNew           = "pm.FeeHouseNew"
	FeeHouseEventBeforeCreate  = "pm.FeeHouseBeforeCreate"
	FeeHouseEventBeforeUpdate  = "pm.FeeHouseBeforeUpdate"
	FeeHouseEventBeforeSave    = "pm.FeeHouseBeforeCreate pm.FeeHouseBeforeUpdate"
	FeeHouseEventAfterCreate   = "pm.FeeHouseAfterCreate"
	FeeHouseEventAfterUpdate   = "pm.FeeHouseAfterUpdate"
	FeeHouseEventAfterSave     = "pm.FeeHouseAfterCreate pm.FeeHouseAfterUpdate"
	FeeHouseEventDelete        = "pm.FeeHouseDelete"
	FeeHouseAccessControlEvent = "pm.FeeHouseAccessControl"
)

func GetFeeHouseConfig() *mgo.DocConfig {
	return FeeHouse_Config
}

var FeeHouse_Config *mgo.DocConfig

func init() {
	FeeHouse_Config = NewFeeHouseConfig()
}
func NewFeeHouseConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "pm.FeeHouse",
		Fields: []string{
			"house", "name", "startAt", "endAt", "amount", "isPay", "payAt", "payType", "note", "p", "order",
		},
		RelationFields: []string{
			"house", "payType", "order",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"house": {
				Config:     GetHouseConfig,
				DocName:    "House",
				JoinType:   "O",
				KeyInside:  "houseId",
				KeyOutSide: "id",
			},
			"payType": {
				Config:     GetPayTypeConfig,
				DocName:    "PayType",
				JoinType:   "O",
				KeyInside:  "payTypeId",
				KeyOutSide: "id",
			},
			"order": {
				Config:     GetFeeHouseOrderConfig,
				DocName:    "FeeHouseOrder",
				JoinType:   "O",
				KeyInside:  "orderId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
